#ifndef PROCESSDATAMANAGER_H
#define PROCESSDATAMANAGER_H

#include <QObject>
#include <QFile>
#include <QThread>
#include "parametermodel.h"
#include "parametersqldb.h"

class ProcessDataManager : public QObject
{
    Q_OBJECT
public:
    explicit ProcessDataManager(QObject *parent = nullptr);

    void initDatabase();
    Q_INVOKABLE void searchData(const QString &keyword);
    Q_INVOKABLE bool initTable();
    Q_INVOKABLE void getAllData();
    Q_INVOKABLE void addData();
    Q_INVOKABLE void deleteData(int id);
    Q_INVOKABLE void saveData(int id, const QString &propertyName, const QString &value);
    // Q_INVOKABLE bool updateData(int id, const QString& propertyName, const QString& value);

signals:
    void dataLoaded(ParameterModel *model);

private:
    ParameterModel *m_model = new ParameterModel(this);
    ParameterSQLDB *m_db = new ParameterSQLDB(this);

    QMutex m_dbMutex;
};

#endif // PROCESSDATAMANAGER_H
